/**
 * SoundWrap methods.
 * @author Terry Brashaw
 * @date Oct 5
 */

#include "SoundWrap.h"

/*
SoundWrap::SoundWrap(const std::string& filename,const  std::string& identifier)
{
        buffer.LoadFromFile(filename);
        this->identifier = identifier;
}
 * */


SoundWrap::SoundWrap(const string& relPath, const string& sId, int iId, bool loops) {
    Setup(relPath, sId, iId, loops);
}

/**
 * SoundWrap::Setup
 * Loads a file to the Sound item and sets up the IDs
 * @param relPath string		Path of the file
 * @param	sId	string				String ID of the sound
 * @param iId int						Integer ID of the sound
 * 
 * Refactored to match existing code better
 * @date Oct 18, 2010
 * @author Rachel
 * */
void SoundWrap::Setup(const string& relPath, const string& sId, int iID, bool loops) {
    if (!sndbuff.LoadFromFile(relPath)) {
        cerr << "Error loading in sound " << sId << " at " << relPath << endl;
    } else {
        cout << "Loaded in sound " << relPath << " successfully!" << endl;

        snd.SetBuffer(sndbuff);
        snd.SetLoop(loops);
    }

    this->sId = sId;
    this->iId = iId;
}
